home *** CD-ROM | disk | FTP | other *** search
/ Delphi Informant Complete 1995 - 2000 / Delphi Informant Complete 1995 to 2000.iso / Delphi Informant Magazine Complete Works SOURCE CODE 1995.rar / 1995 / JUN / GE9506 / tstexcep.pas < prev   
Pascal/Delphi Source File  |  1995-05-04  |  1KB  |  62 lines

  1. unit Tstexcep;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, Texcept, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     Button2: TButton;
  13.     ExceptionHandler1: TExceptionHandler;
  14.     procedure Button1Click(Sender: TObject);
  15.     procedure Button2Click(Sender: TObject);
  16.   private
  17.     { Private declarations }
  18.   public
  19.     { Public declarations }
  20.   end;
  21.  
  22. var
  23.   Form1: TForm1;
  24.  
  25. implementation
  26.  
  27. {$R *.DFM}
  28.  
  29. procedure TForm1.Button1Click(Sender: TObject);
  30. var
  31.   Num, X : Integer;
  32. begin
  33.   X := 0;
  34.   try
  35.     Num := 9 div X;
  36.   except
  37.     on E : Exception do    { exception instance }
  38.       if ExceptionHandler1.Active = True then
  39.         ExceptionHandler1.Ondo(E)
  40.       else
  41.         ShowMessage('Custom Exception Handler not active.');
  42.    end;
  43. end;
  44.  
  45. procedure TForm1.Button2Click(Sender: TObject);
  46. var
  47.   Num, X : Double;
  48. begin
  49.   X := 0;
  50.   try
  51.     Num := 9 / X;
  52.   except
  53.     on E : Exception do    { exception instance }
  54.       if ExceptionHandler1.Active = True then
  55.         ExceptionHandler1.Ondo(E)
  56.       else
  57.         ShowMessage('Custom Exception Handler not active.');
  58.    end;
  59. end;
  60.  
  61. end.
  62.